package com.iweb.initcount.servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HitCountServlet extends HttpServlet {
    private int initcount;

    public void init(ServletConfig config) throws ServletException {
        super.init(config);
        initcount = Integer.parseInt(config.getInitParameter("init"));
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        initcount++;
        out.println("HTML");
        out.println("<HEAD><TITLE>BasicServlet</TITLE></HEAD>");
        out.println(" <BODY>");
        out.print("You are user number " + String.valueOf(initcount) + "visiting our web site" + "\n");
        out.println(" </BODY>");
        out.println("</HTML>");

    }
}